package br.unidocs.modelo.entidade;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the arquivos database table.
 * 
 */
@Entity
@Table(name = "arquivos")
public class Arquivo implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name = "ARQUIVOS_ID_GENERATOR", sequenceName = "SEQ_ID_ARQ", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ARQUIVOS_ID_GENERATOR")
	@Column(name = "id_arq")
	private Integer id;

	@Column(name = "desc_arq")
	private String descricao;

	@Temporal(TemporalType.DATE)
	@Column(name = "dt_upload_arq")
	private Date dataUpload;

	@Column(name = "nome_arq")
	private String nome;

	@Column(name = "tamanho_arq")
	private Integer tamanho;

	// bi-directional many-to-one association to Usuario
	@ManyToOne
	@JoinColumn(name = "id_usu_arq")
	private Usuario usuario;

	// bi-directional many-to-many association to Tag
	@ManyToMany(cascade = { CascadeType.PERSIST })
	@JoinTable(name = "arquivos_tags", joinColumns = { @JoinColumn(name = "id_arq_arq_tag") }, inverseJoinColumns = { @JoinColumn(name = "id_tag_arq_tag") })
	private List<Tag> tags;

	// bi-directional many-to-one association to Comentario
	@OneToMany(mappedBy = "arquivo", cascade = CascadeType.REMOVE)
	private List<Comentario> comentarios;

	// // bi-directional many-to-one association to Voto
	// @OneToMany(mappedBy = "arquivo")
	// private Set<Voto> votos;

	public Arquivo() {
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDescricao() {
		return this.descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Date getDataUpload() {
		return this.dataUpload;
	}

	public void setDataUpload(Date dataUpload) {
		this.dataUpload = dataUpload;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Integer getTamanho() {
		return this.tamanho;
	}

	public void setTamanho(Integer tamanho) {
		this.tamanho = tamanho;
	}

	public Usuario getUsuario() {
		return this.usuario;
	}

	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}

	public List<Tag> getTags() {
		return this.tags;
	}

	public void setTags(List<Tag> tags) {
		this.tags = tags;
	}

	public List<Comentario> getComentarios() {
		return this.comentarios;
	}

	public void setComentarios(List<Comentario> comentarios) {
		this.comentarios = comentarios;
	}

	// public Set<Voto> getVotos() {
	// return this.votos;
	// }
	//
	// public void setVotos(Set<Voto> votos) {
	// this.votos = votos;
	// }

}